package com.ray.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespBean {
    private Integer code;
    private String message;
    private Object data;

    /**
     * 成功返回
     * @param message
     * @return
     */
    public static RespBean success(String message){
        return new RespBean(200,message,null);
    }

    /**
     * 成功返回
     * @param message
     * @return
     */
    public static RespBean success(String message, Object date){
        return new RespBean(200,message,date);
    }

    /**
     * 失败返回
     * @param message
     * @return
     */
    public static RespBean error(String message){
        return new RespBean(500,message,null);
    }

    /**
     * 失败返回
     * @param message
     * @return
     */
    public static RespBean error(String message, Object date){
        return new RespBean(200,message,date);
    }

}
